# -*-coding:utf-8-*-
# ProjectName: smalleel-api-tools
# FileName: water_acceptance_main.py
# @Time :2023/8/15 14:52
# @Author :
# @Description:水表及水表基站出入库到上线
from common.util.randomUtil.randomUtil import get_random_char
from tool.process.smalleelLogin import Login
from tool.process.acceptance.smalleel.register.register_acceptance import RegisterEquipment
from tool.process.acceptance.merchant.merchant_acceptance import Merchant


def water_main():
    """
       注意：运行此文件时需要在配置中（acceptConfig.py）选择deviceType = 6
       水表表号规则: 14位数字
    """
    Login().login_smalleel()
    Login().login_merchant()
    Login().login_platform()
    regist = RegisterEquipment()
    mer = Merchant()
    # 基站号和数量
    collectoNo = "W5" + get_random_char(10)
    collectoNum = 2
    # 水表表号和数量
    meterNo = int("4552023" + get_random_char(6) + "4")
    meterNum = 2
    # 注册水表基站后入库并出库到对应项目
    regist.register_collector(collectoNo, collectoNum)
    # 注册水表后入库并出库到对应项目
    regist.register_meter(meterNo, meterNum)
    # 小程序添加水表基站
    mer.add_Collector(collectoNo, collectoNum)
    # 小程序添加水表
    mer.add_WaterDb(meterNo, meterNum)


if __name__ == '__main__':
    water_main()
